/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servlets.exam;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author FRIENDS
 */
@WebServlet(name = "startexam", urlPatterns = {"/student/exam/startexam"})
public class startexam extends HttpServlet {

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        String examid=request.getParameter("examid");
         if(helper.exam.remainingDays(examid)==0)
         {
             
             Date starttime=new Date();
             Date endtime= new Date();
             starttime.setHours(0);
             starttime.setMinutes(0);
             starttime.setSeconds(0);
             
             request.getSession().setAttribute("starttime", starttime);
            
         }
    
    }

    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
